<template>
    <div>
        <table class="table">
            <tbody>
                <tr>
                    <td>用户名</td>
                    <td><input type="text" v-model="data.name"></td>
                </tr>
                <tr>
                    <td>密码：</td>
                    <td><input type="password" v-model="data.pwd"> </td>
                </tr>
                <tr>
                    <td><input type="button" value="登录" @click="Login"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import {ref} from 'vue';
const data=ref({
    name:'',
    pwd:''
})
const Login=()=>{
    //模拟登录成功保存用户名+登录成功的状态
    if(data.value.name=="admin"&&data.value.pwd=="123")
    {
        //登录成功【保存用户名+登录成功的状态】
        localStorage.setItem("isLogin","true");//当登录成功进保存登录状态true
        alert("成功成功！")
    }
}
</script>

<style scoped>

</style>